﻿using UnityEngine;
using System.Collections;

public class ShipController1 : MonoBehaviour {
	static public bool moveForward = false;
	static public bool moveBackward = false;
	static public bool rotLeft = false;
	static public bool rotRight = false;

	public int shipSpeed;
	public int rotationSpeed;

	
	// Update is called once per frame
	void Update () 
	{
		upMovement ();
		downMovement ();
		leftRotation ();
		rightRotation ();
	
	}


	
	void upMovement() //Function for Moving Up
	{
		if(moveForward)
		{
			rigidbody.AddRelativeForce(Vector3.forward * shipSpeed * Time.deltaTime);
		}			
	}
	
	void downMovement() //Function for Moving Down
	{
		if(moveBackward)
		{
			rigidbody.AddRelativeForce(Vector3.back * shipSpeed * Time.deltaTime);
		}		
	}
	
	void leftRotation() // For Rotating the Ship Left
	{
		if(rotLeft)
		{
			transform.Rotate(Vector3.down * rotationSpeed, rotationSpeed * Time.deltaTime);
		}		
	}
	
	void rightRotation() //Function for Rotating Right
	{
		if(rotRight)
		{
			transform.Rotate(Vector3.up * rotationSpeed, rotationSpeed * Time.deltaTime);
		}			
	}
}
